<?php
/*
 *  This file is part of MetaMVC.
 * 
 *  MetaMVC is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  MetaMVC is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with MetaMVC.  If not, see <http://www.gnu.org/licenses/>.
 */
namespace MetaMVC\Framework\Routing;

/**
 * @author artzter
 */
class Route extends RouteProperties {
    /**
     * URL Expression to match the current route.
     * @var string
     * @access private
     */
    private $regex;

    /**
     * Class Constructor
     * @param string $regex URL Expression to match the current route.
     * @param string $controller Name of the destination controller.
     * @param string $action Name of the destination action.
     * @param string $area Name of the destination area.
     * @return void
     */
    public function __construct($regex, $controller = null, $action = null) {
        $this->setController($controller);
        $this->setAction($action);
        $this->regex = $regex;
    }

    public function match($uri) {
        return preg_match('~' . $this->regex . '~', $uri);
    }
}

?>
